package dongshi.daddy.abstractfactory.factory;

import dongshi.daddy.abstractfactory.product.Brake;
import dongshi.daddy.abstractfactory.product.Wheel;
import dongshi.daddy.abstractfactory.product.plane.Plane;
import dongshi.daddy.abstractfactory.product.plane.PlaneBrake;
import dongshi.daddy.abstractfactory.product.plane.PlaneWheel;

public class PlaneFactory extends AbstractFactory<PlaneBrake, PlaneWheel, Plane> {
    @Override
    protected PlaneBrake createBrake() {
        return new PlaneBrake();
    }

    @Override
    protected PlaneWheel createWheel() {
        return new PlaneWheel();
    }

    @Override
    public Plane createProduct() {
        Brake brake = createBrake();
        brake.brake();
        Wheel wheel = createWheel();
        wheel.run();
        return new Plane(brake, wheel);
    }
}
